package cn.com.lei.du.service.impl;

import cn.com.lei.du.entity.User;
import cn.com.lei.du.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private RestTemplate restTemplate;

    @Override
    public User findById(String id) {
        return restTemplate.postForObject("http://service01/user/findById/"+id,null,User.class);
    }

    public User addUser(User user){
        return restTemplate.postForEntity("http://service01/user/addUser",user,User.class).getBody();
    }
}
